<div class="bg-light lter b-b wrapper-md">
	<h1 class="m-n font-thin h3">
		<a id="head"></a>用户新增/修改
	</h1>
</div>
<div class="wrapper-md no-padder" ng-controller="sys_userEditController">
	<div class="panel panel-default">
		<div class="panel-body">
			<uib-tabset class="tab-container" type="pills" active="steps.active" ng-init="steps={percent:10, step1:true, step2:false, step3:false}" justified="true">
				<uib-tab heading="账号信息" select="steps.percent=0">
					 <uib-progressbar value="steps.percent" class="progress-xs" type="success"></uib-progressbar>
					 <form name="step1" class="form-horizontal form-validation">
				       	<label class="col-sm-2 control-label">账号</label>
						<div class="col-sm-4">
							<input type="text" name="account" class="form-control  m-b-xs" ng-model="entity.name" ng-disabled="type == 'update'" 
								ui-validate-async="{unique : 'unique($value)' }" ng-pattern="/^[a-zA-Z0-9]{4,10}$/" required> 
							<div class="bg-danger" ng-show="step1.account.$invalid">
                                <div ng-show="step1.account.$error.unique">用户名已经存在，请重新输入</div>
                                <div ng-show="step1.account.$error.pattern">请输入4-10为数字和字母组合</div>
                            </div>
						</div>
						<div class="line line-dashed b-b line-lg pull-in"></div>
				       	<label ng-if="type == 'add'" class="col-sm-2 control-label">密码</label>
						<div ng-if="type == 'add'" class="col-sm-4">
							<input type="password" name="password" class="form-control  m-b-xs" ng-model="entity.password" ng-pattern="/^[a-zA-Z0-9]{4,10}$/" required> 
							<div class="bg-danger" ng-show="step1.password.$invalid">
                                <div ng-show="step1.password.$error.pattern">请输入4-10为数字和字母组合</div>
                            </div>
						</div>
						<div ng-if="type == 'add'" class="line line-dashed b-b line-lg pull-in"></div>
				       	<label ng-if="type == 'add'" class="col-sm-2 control-label">重复密码</label>
						<div ng-if="type == 'add'" class="col-sm-4">
							<input type="password" class="form-control  m-b-xs" ng-model="confirmPassword" ui-validate-watch="'entity.password'" ui-validate=" '$value==entity.password' " required="required" > 
						</div>
						<div ng-if="type == 'add'" class="line line-dashed b-b line-lg pull-in"></div>
				        <div class="col-sm-5 col-sm-offset-2">
				        	<button type="submit" class="btn btn-default" ui-sref="app.system.user.list" >返回</button>&nbsp;&nbsp;&nbsp;&nbsp;
				          	<button type="submit" ng-disabled="step1.$invalid" class="btn btn-default " ng-click="steps.active = 1">下一步</button>
				        </div>
				        <div class="line line-dashed pull-in"></div>
				      </form>
				</uib-tab>
				<uib-tab heading="用户基本信息" disable="step1.$invalid" active="steps.step2" select="steps.percent=30">
					<uib-progressbar value="steps.percent" class="progress-xs" type="success"></uib-progressbar>
					<form name="step2" class="form-horizontal form-validation">
				      	<label class="col-sm-2 control-label">邮箱</label>
						<div class="col-sm-4">
							<input type="email" class="form-control  m-b-xs" ng-model="entity.email"> 
						</div>
				        <div class="line line-dashed b-b line-lg pull-in"></div>
				      	<label class="col-sm-2 control-label">手机</label>
						<div class="col-sm-4">
							<input type="text" name="phone" class="form-control  m-b-xs" ng-model="entity.phone" ng-pattern="/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/"> 
							<div class="bg-danger" ng-show="step2.phone.$invalid">
                                <div ng-show="step2.phone.$error.pattern">请输入正确的手机号码</div>
                            </div>
						</div>
				        <div class="line line-dashed b-b line-lg pull-in"></div>
				        <div class="col-sm-5 col-sm-offset-2">
				          <button type="button" class="btn btn-default" ng-click="steps.active = 0">上一步</button>&nbsp;&nbsp;&nbsp;&nbsp;
				          <button type="button" ng-disabled="step2.$invalid" class="btn btn-default" ng-click="steps.active = 2">下一步</button>
				        </div>
				        <div class="line line-dashed pull-in"></div>
				      </form>
				</uib-tab>
				<uib-tab heading="用户角色信息" disable="step2.$invalid || step1.$invalid" active="steps.step3" select="steps.percent=60">
					<uib-progressbar value="steps.percent" class="progress-xs" type="success"></uib-progressbar>
					<form name="step3" class="form-horizontal form-validation">
						<div class="col-sm-5 col-sm-offset-2">
							<div app-ztree="setting" id="userEditRolestree" check-box="true" tree-date="roles"></div>
						</div>
						<div class="col-sm-5 col-sm-offset-2">
							<div class="m-b-md">
								<uib-alert ng-repeat="alert in Alert.alerts" type="{{alert.type}}" close="Alert.closeAlert($index)">
								{{alert.msg}} </uib-alert>
							</div>
							<!-- / alert -->
							<button type="submit" class="btn btn-default" ng-click="steps.active = 1">上一步</button>&nbsp;&nbsp;&nbsp;&nbsp;
							<button type="submit" class="btn btn-primary" ng-disabled="step3.$invalid || saveBtnDisable"
								ng-click="save(); saveBtnDisable = true;">保存</button>&nbsp;&nbsp;&nbsp;&nbsp;
						</div>
						<div class="line line-dashed pull-in"></div>
					</form>
				</uib-tab>
			</uib-tabset>
		</div>
	</div>
</div>